
class DashController {
  static getAnalyseDate(ctx){
    // 处理一下词云的数据
    const {data,dataMarket} =require('../../utils/data')
    var data2={}
    var i=0
    // for(i=0;i<chartData1[1].list.length;i++){
    //   data2[i]=[]
    // }
    // for(i=0;i<chartData1.length;i++){    //7
    //   for(var j=0;j<chartData1[i].list.length;j++)   //5
    //   d[j].push(chartData1[i].list[j])
    // }
    for(let e in data[0]){
      data2[e]=[]
    }
    for(i=0;i<data.length;i++){
      for(let ele2 in data[i]){
        data2[ele2].push(data[i][ele2])
      }
    }
    ctx.body={
      err:0,
      msg:'success',
      data:{
        orderSale:[
          {id:11,name:'衬衫',sale:5},
          {id:12,name:'鞋子',sale:10},
          {id:13,name:'杯子',sale:50},
          {id:14,name:'手机',sale:100},
          {id:15,name:'电脑',sale:20},
        ],
        cityTemplature:[
          {id:1,city:'Tokyo',templature:[7,10,15,16,20,26,28,30,26,20,18,5]},
          {id:2,city:'London',templature:[15,20,26,30,31,29,28,20,16,11,8,5]}
        ],
        radarData:[
          { item: 'Design', a: 70, b: 30 },
          { item: 'Development', a: 60, b: 70 },
          { item: 'Marketing', a: 50, b: 60 },
          { item: 'Users', a: 40, b: 50 },
          { item: 'Test', a: 60, b: 70 },
          { item: 'Language', a: 70, b: 50 },
          { item: 'Technology', a: 50, b: 40 },
          { item: 'Support', a: 30, b: 40 },
          { item: 'Sales', a: 60, b: 40 },
          { item: 'UX', a: 50, b: 60 },
        ],
        bizChart:data2,
        dataMarket:dataMarket,
        Interval:[
          { year: '1951 年', sales: 0 },
          { year: '1952 年', sales: 52 },
          { year: '1956 年', sales: 61 },
          { year: '1957 年', sales: 45 },
          { year: '1958 年', sales: 48 },
          { year: '1959 年', sales: 38 },
          { year: '1960 年', sales: 38 },
          { year: '1962 年', sales: 38 },
        ]
      }
    }
  } 
  static getEcharts(ctx){
    const {firstoption ,pieoption,ploaroption,negaoption ,cateoption} =require('../../utils/data')
    ctx.body={
      err:0,
      msg:'success',
      data:{
        firstoption,
        pieoption,
        ploaroption,
        negaoption,
        cateoption
      }
    }
  }
}
module.exports = DashController